<template>
	<view class="mine">
		<!-- <view class="tab-item" @click="setPwd">
			<view class="lable">密码设置</view>
			<uni-icons type="arrowright" color="#ccc" size="16"></uni-icons>
		</view> -->
		<view class="login_out" @click="hanleLoginOut">退出登录</view>
	</view>
</template>

<script>
import { loginOut } from '@/apis/login.js';
import { mapState, mapActions } from 'vuex';
// import neilModal from '@/components/neil-modal/neil-modal.vue';
import { hanleToken } from '@/utils/utils.js';
export default {
	// components: { neilModal },
	data() {
		return {};
	},
	computed: {
		...mapState('user', ['userinfo'])
	},
	onShow() {},
	onload() {},
	methods: {
		...mapActions('user', ['handleRreshToken','logoutFuc']),
		setPwd() {
			uni.navigateTo({
				url: './setPassword'
			});
		},
		hanleLoginOut() {
			let _this = this;
			uni.showModal({
				content: '是否确定退出登录',
				success(res) {
					if (res.confirm) {
						uni.showLoading({
							title: '加载中'
						});
						uni.hideLoading();
						loginOut().then(res => {
							if (res) {
								uni.hideLoading();
								hanleToken('remove', 'token');
								hanleToken('remove', 'refresh_token');
								_this.logoutFuc();
								// reomoveRefreshToken('refreshToken')
								setTimeout(() => {
									// uni.navigateTo({
									// 	url: '/pages/login/accountLogin?type=1'
									// });
									uni.navigateTo({
										url: '/pages/login/index'
									});
								}, 500);
							}
						});
					}
				}
			});
		}
	},

};
</script>

<style scoped lang="scss">
.mine {
	height: 100vh;
	background: #f3f6f8;
	display: flex;
	flex-direction: column;
	align-items: center;
	color: #333;
	.tab-item {
		width: 92%;
		font-size: 28rpx;
		background-color: #fff;
		margin-bottom: 20rpx;
		padding: 25rpx 4%;
		display: flex;
		justify-content: space-between;
		align-items: center;
	
	}
	.login_out {
		width: 100%;
		font-size: 28rpx;
		background: #fff;
		font-size: 28rpx;
		padding: 25rpx 0;
		display: flex;
		justify-content: center;
		align-items: center;
	}
}
</style>
